//
//  AiNavigationViewController.m
//  ROSE
//
//  Created by 艾阳 on 2018/5/22.
//  Copyright © 2018年 HeNanZhongDunYunAn. All rights reserved.
//

#import "AiNavigationViewController.h"

@interface AiNavigationViewController ()

@end

@implementation AiNavigationViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    /**
     设置导航栏背景颜色
     */
    [self.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor colorWithRed:233/255.0 green:123/255.0 blue:155/255.0 alpha:1]] forBarMetrics:(UIBarMetricsDefault)];
    
    /**
     设置导航栏字体颜色
     */
    [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.viewControllers.count >= 1) {
        UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 20)];
        [btn setImage:[UIImage imageNamed:@"返回"] forState:UIControlStateNormal];
        [btn.imageView setContentMode:UIViewContentModeScaleAspectFit];
        [btn setImageEdgeInsets:UIEdgeInsetsMake(0, -50, 0, 0)];
        [btn addTarget:self action:@selector(popSelector) forControlEvents:UIControlEventTouchUpInside];
        btn.tintColor = [UIColor whiteColor];
        UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:btn];
        viewController.navigationItem.leftBarButtonItem = item; }
    if (self.childViewControllers.count != 0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    
    [super pushViewController:viewController animated:animated];
}
- (void)popSelector {
    [self popViewControllerAnimated:YES];
}


@end
